////////////////////////////////////////////////////////////////////////////
//
//  Crytek Engine Source File.
//  Copyright (C), Crytek Studios, 2002.
// -------------------------------------------------------------------------
//  File name:   inplacebutton.cpp
//  Version:     v1.00
//  Created:     6/6/2002 by Timur.
//  Compilers:   Visual Studio.NET
//  Description: 
// -------------------------------------------------------------------------
//  History: Based on Stefan Belopotocan code.
//
////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "InPlaceButton.h"

// CInPlaceButton

IMPLEMENT_DYNAMIC(CInPlaceButton, CXTButton)

BEGIN_MESSAGE_MAP(CInPlaceButton, CXTPButton)
	ON_CONTROL_REFLECT(BN_CLICKED, OnBnClicked)
	ON_WM_CREATE()
END_MESSAGE_MAP()

CInPlaceButton::CInPlaceButton( OnClick onClickFunctor )
{
	m_onClick = onClickFunctor;
	SetTheme(xtpButtonThemeOffice2003);
}

CInPlaceButton::CInPlaceButton( OnClick onClickFunctor,bool bNoTheme )
{
	m_onClick = onClickFunctor;
	if (!gSettings.gui.bSkining)
		SetTheme(xtpButtonThemeOffice2003);
}
int CInPlaceButton::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
	SetFont( CFont::FromHandle(gSettings.gui.hSystemFont) );
	return 0;
}


IMPLEMENT_DYNAMIC(CInPlaceColorButton, CColorButton)
BEGIN_MESSAGE_MAP(CInPlaceColorButton, CColorButton)
	ON_CONTROL_REFLECT(BN_CLICKED, OnBnClicked)
	ON_WM_CREATE()
	ON_WM_ERASEBKGND()
END_MESSAGE_MAP()

//////////////////////////////////////////////////////////////////////////
int CInPlaceColorButton::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
	if(__super::OnCreate(lpCreateStruct) == -1) 
		return -1;
	SetFont( CFont::FromHandle(gSettings.gui.hSystemFont) );
	return 0;
}

//////////////////////////////////////////////////////////////////////////
BOOL CInPlaceColorButton::OnEraseBkgnd( CDC* pDC )
{
	return TRUE;
}